# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: svoufff <svoufff at gmail dot com>
# Contributor: Shinlun Hsieh <yngwiexx@yahoo.com.tw>

pkgname=libgig
pkgver=4.3.0
pkgrel=4
pkgdesc="C++ library for loading, modifying and creating .gig, .ksf, .kmp, .sf2 and DLS files"
arch=(loong64 x86_64)
url="https://www.linuxsampler.org/libgig/"
license=(GPL2)
depends=(
  gcc-libs
  glibc
  util-linux-libs
  libsndfile libsndfile.so
)
makedepends=(
  util-linux
)
provides=(libgig.so)
source=(
  https://download.linuxsampler.org/packages/$pkgname-$pkgver.tar.bz2
  $pkgname-4.3.0-libdir.patch
)
sha512sums=('683c09b1d17acf69020c631452b7dfb25ac54c3701db5e97471d4e7973e9a06267667bf19bfe4eb00d2964223e8446f248d93b4cf29c062dec2588758b4dfba2'
            '7bc339ff8fddc7e35ab8a58a591038bc06b8fb3acc895b471968e8731608e1524d74c3e58f6e5cff06ca1a4fd0c09de85e6ffedff0336df31270aeaf5aef6f81')
b2sums=('9d1482b4e704dc96bdc44b2b95ed1479f27488567e5f5216dfdf84e7eb51a07a9f8b9550ce6208156e9f2bc43a3495ab6a77c2672e564e2f36fd9734cb4a88fd'
        '67790271997b476b4fdd6eb82c69d889de3a2d0f419d5338fa552d8ebdaef37f12596307fc1831af3e2bae1e270e714f41358a71f518d912bed2200917957c74')

prepare() {
  # install libgig.so as a globally visible shared object
  patch -Np1 -d $pkgname-$pkgver -i ../$pkgname-4.3.0-libdir.patch
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  # prevent excessive overlinking due to libtool
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  make DESTDIR="$pkgdir" install -C $pkgname-$pkgver
  install -vDm 644 $pkgname-$pkgver/{AUTHORS,ChangeLog,NEWS,README,TODO} -t "$pkgdir/usr/share/doc/$pkgname/"
}
# vim:set ts=2 sw=2 et:
